package com.gao.controller;

import com.gao.pojo.User;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Projectname springboot-09-swagger
 * @Filename HelloController
 * @Author an
 * @Data 2022/8/15 14:15
 * @Description TODO
 */

@RestController
public class HelloController {

    @GetMapping ("/hello")
    public String hello(){
        return "hello";
    }

    //方法返回值中有存在实体类，就会被扫描
    @PostMapping("/user")
    public User user(){
        return  new User();
    }

    @ApiOperation("测试方法")
    @GetMapping("/test")
    public String hello3(@ApiParam("用户名") String name){
        return name;
    }

}
